<template>
  <div class = "divMain">
    <ul>
      <li v-for = 'sc in schedulelist' :key = 'sc.scheduleId'>
        <schedule :scheduleInfo = sc></schedule>
        <hr/>
      </li>
    </ul>
    <button @click="show">{{ showdetail }}</button>
    <ul>
      <li v-for = 'dc in doctorlist' :key = 'dc.doctorId'>
        <doctorCard :doctor = dc></doctorCard>
      </li>
    </ul>
    <ul>
      <li v-for = 'pt in patientlist' :key = 'pt.userId'>
        <patientCard :patient = pt :detailShowFlag = isShowDetail></patientCard>
      </li>
    </ul>
  </div>
</template>

<script>
import patientCard from '../components/base/PatientCard'
import doctorCard from '../components/base/DoctorCard'
import schedule from '../components/base/Schedule'
export default {
  name: 'Index',
  components: {
    patientCard,
    doctorCard,
    schedule
  },
  data () {
    return {
      schedulelist: [
        {
          timeRange: '08:00-09:00',
          count: 2,
          scheduleId: '0',
          apptCost: '7.00'
        },
        {
          timeRange: '09:00-10:00',
          count: 0,
          scheduleId: '1',
          apptCost: '7.00'
        },
        {
          timeRange: '10:00-11:00',
          count: 2,
          scheduleId: '2',
          apptCost: '7.00'
        }
      ],
      doctorlist: [
        {
          doctorName: '陈一言',
          iconUrl: '',
          title: '主治医师',
          gender: 'M',
          doctorId: '0'
        }
        ,
        {
          doctorName: '张一山',
          iconUrl: '',
          title: '主任医师',
          gender: 'M',
          doctorId: '1'
        },
        {
          doctorName: '郭嘉',
          iconUrl: '',
          title: '省级名医',
          gender: 'M',
          doctorId: '2'
        }
      ],
      patientlist: [
        {
          patientName: '张无忌',
          iconUrl: '',
          idcardNum: '55**************23',
          phone: '18050489632',
          patientNo: '66666666',
          ipatientNo: '未绑定',
          gender: 'M',
          userId: '0',
          barcode: ''
        }
        ,
        {
          patientName: '孙武',
          iconUrl: '',
          idcardNum: '88**************72',
          phone: '17750482252',
          patientNo: '121222121',
          ipatientNo: '未绑定',
          gender: 'M',
          userId: '1',
          barcode: ''
        },
        {
          patientName: '陈玄风',
          iconUrl: '',
          idcardNum: '89**************42',
          phone: '13950485524',
          patientNo: '99999999',
          ipatientNo: '未绑定',
          gender: 'M',
          userId: '2',
          barcode: ''
        }
      ],
      isShowDetail: true,
      showdetail: '隐藏明细'
    }
  },
  methods: {
    show () {
      if(this.isShowDetail){
        this.isShowDetail = false
        this.showdetail = '显示明细'
      } else {
        this.isShowDetail = true
        this.showdetail = '隐藏明细'
      }
    }
  }
}
</script>

<style scoped>
.divMain {
  margin: 10px;
}

li {
  margin-top:10px;
}
</style>
